package com.sfdcj.se;

import java.io.CharArrayWriter;
import java.io.PrintWriter;

public class SfdcException extends RuntimeException {

	private StringBuffer msg = new StringBuffer();

	private Exception e;

	public SfdcException(Exception e) {
		this.e = e;
	}
	
	public SfdcException(String msg) {
		this.msg.append(msg);
	}

	public SfdcException(Exception e, String msg) {
		addMessage(msg);
	}

	public void addMessage(String msg) {
		this.msg.append(msg);
	}

	public String toString() {
		CharArrayWriter buf = new CharArrayWriter();
		PrintWriter writer = new PrintWriter(buf);
		e.printStackTrace(writer);
		return msg.toString() + " | " + writer.toString();
	}
}
